require([
  "esri/map","esri/graphic","esri/geometry/Point","esri/SpatialReference","esri/tasks/GeometryService",
  "esri/tasks/LengthsParameters","esri/tasks/AreasAndLengthsParameters","esri/tasks/FindTask","esri/tasks/FindParameters",
  "esri/tasks/query","esri/tasks/QueryTask","esri/tasks/StatisticDefinition",
  "esri/layers/ArcGISTiledMapServiceLayer", "esri/layers/ArcGISDynamicMapServiceLayer","esri/layers/FeatureLayer", 
  "esri/tasks/ClassBreaksDefinition", "esri/tasks/AlgorithmicColorRamp","esri/geometry/screenUtils",
  "esri/tasks/GenerateRendererParameters", "esri/tasks/GenerateRendererTask","esri/dijit/OverviewMap","esri/dijit/BasemapGallery","esri/dijit/Scalebar",
  "esri/symbols/SimpleLineSymbol", "esri/symbols/SimpleFillSymbol", 
  "esri/toolbars/draw","esri/toolbars/navigation","esri/dijit/Measurement",
  "esri/dijit/PopupTemplate", "esri/dijit/Legend", "esri/config",
  "dojo/parser", "dojo/_base/array", "dojo/_base/lang","dojox/encoding/base64","esri/Color","dojo/on","dojo/dom-attr","dojo/dom-class","dojo/dom-style","dojo/query",
  "dojo/dom", "dojo/dom-construct","dijit/registry","dojo/json",
  "dojo/data/ItemFileReadStore", "dijit/form/FilteringSelect",
  "dgrid/OnDemandGrid",
  "dgrid/Selection", 
  "dgrid/extensions/Pagination", "dojo/store/Observable",
  "dojo/store/Memory", "dojo/store/Cache", "dojo/store/JsonRest", 
  "dojox/charting/Chart",
  "dojox/charting/themes/Bahamation",
  "dojo/_base/declare", "esri/layers/GraphicsLayer",
  "dijit/dijit-all", // dijit.*
  "dojox/layout/ResizeHandle",
  "dojox/widget/Dialog",
  "dojox/layout/FloatingPane",
  "dojo/dnd/Moveable",
  "dojo/fx",
  "dojox/layout/Dock","dojox/grid/EnhancedGrid","dojox/grid/enhanced/plugins/GridSource","dojox/grid/enhanced/plugins/Pagination",
  "dojox/grid/enhanced/plugins/CellMerge","dojox/charting/DataChart",  
  "dojo/domReady!"
], function(
  Map, Graphic,Point,SpatialReference,GeometryService,
  LengthsParameters,AreasAndLengthsParameters,FindTask,FindParameters,
  Query, QueryTask, StatisticDefinition,
  ArcGISTiledMapServiceLayer, ArcGISDynamicMapServiceLayer,FeatureLayer, 
  ClassBreaksDefinition, AlgorithmicColorRamp,screenUtils,
  GenerateRendererParameters, GenerateRendererTask,OverviewMap,BasemapGallery,Scalebar,
  SimpleLineSymbol, SimpleFillSymbol, 
  Draw,Navigation,Measurement,
  PopupTemplate, Legend,esriConfig,
  parser, arrayUtils,lang,base64,Color,on,
  domAttr,domClass,domStyle,query,dom, domConstruct,registry,JSON,
  ItemFileReadStore, FilteringSelect,
  Grid, 
  Selection, Pagination,Observable,
  Memory, Cache,JsonRest,Chart,Bahamation,
  declare
) {
	var highlightSymbol=new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([78, 171, 214 ]), 4);
    var highlightFillSymbol = new SimpleFillSymbol(
            SimpleFillSymbol.STYLE_SOLID, 
            new SimpleLineSymbol(
              SimpleLineSymbol.STYLE_SOLID, 
              new Color([111, 0, 255]), 
              2
            ), 
            new Color([111, 0, 255, 0.15])
          );
	var map =ssmap.map;
	// 人行道
	ssmap.regionalizationRXD = function () {
		var floatingPane =dijit.byId("floatingPane");
		if(floatingPane) {
			floatingPane.destroyRecursive();
		}
		  var searchurl = appConfig.gisPath+"/arcgis/rest/services/fsjt/bj/MapServer/5"; 
	      var columns = [{
	            label: "区",
	            className:"index",
	            field: "dist"
	        },{
	            label: "区域面积(平方米)",
	            field: "area"
	        },{
	            label: "人行道面积(平方米)",
	            field: "tarea"
	        },{
	            label: "所占比率",
	            field: "",
			    get:function(item){
			         return ((item.tarea/item.area)*100).toFixed(2)+"%";
			    }
	        },{
	            label: "人行道长度(米)",
	            field: "tleng"
	        }
	        ];
			var dataGrid = new (declare([Grid, Selection]))({
			    bufferRows: Infinity,
                 firstLastArrows: false,
			    columns: columns,
			    selectionMode: "single",
			    "class": "listtj2Grid"
			});
			var node = document.createElement('div');
			dojo.body().appendChild(node);
			var dChart= new dijit.layout.ContentPane({
				content:"	<table class='chart-area' id='chart-area' style='width: 700px;'><tr><td style='width: 400px;'>" +
						"<div id='pie' class='chart'></div><div id='pie_legend'></div></td><td style='width: 400px;'>" +
						"<div id='cols' class='chart'></div><div id='cols_legend' ></div></td></tr></table><div class='chart' id='bars'></div>"
				
			});

		    var floatingPane = new dojox.layout.FloatingPane({
		    	draggable:true,
		    	closable :true,
		    	resizable:false,
		    	maxable:false,
		    	id:"floatingPane",
		    	dockable:false,
		    	refreshOnShow:true,
		    	style:"width:800px;  height:430px;padding:5px;z-index: 9999;top: 0px;left:285px;overflow: hidden; ",
		        title:"人行道统计分析"
		      },node);
		      floatingPane.addChild(new dijit.form.Button({label :"导出excel",iconClass :"dijitIconTable",onClick:function(){
		    	  exportExcelF(dataGrid,"人行道数据汇总");
		      }}));
		      floatingPane.addChild(dataGrid);
		      floatingPane.addChild(dChart);
		   var queryTask = new QueryTask(searchurl);
			  var query = new Query();
				query.returnGeometry = true;
				query.outFields = [ "*" ];
				query.where = "1 = 1"; 
				query.orderByFields =["DistId"]
				queryTask.execute(query,function (featureSet) {
					var results = featureSet.features;
					var datas =[];
					dojo.forEach(results, function(feature) {
						var  distId = feature.attributes["DistId"];
						 if(distId) {
							 distId = distId.substr(-1,2);
						 }
						 var tarea =0,tleng=0;
						  var queryTask = new QueryTask(appConfig.gisPath+"/arcgis/rest/services/fsjt/ss/MapServer/50");
							   var data= {
					                    // property names used here match those used when creating the dgrid
					                    "dist":feature.attributes["DistName"],
					                    "area":feature.attributes["SHAPE_Area"],
					                    "tarea": tarea,
					                    "tleng": tleng
					                  }
							   var query2 = new Query();
							   //query.returnGeometry = true;
								//query.geometry= map.extent;
							   query2.outFields = [ "*" ];
							   query2.where = " 编码 like '_____0"+distId+"____'"; 
							   //query.geometry = feature.geometry;
							   var statisticDefinition3 = new StatisticDefinition();
							   statisticDefinition3.statisticType = "sum";
							   statisticDefinition3.onStatisticField = "Shape_Area";
							   statisticDefinition3.outStatisticFieldName = "tarea";
							   var statisticDefinition4 = new StatisticDefinition();
							   statisticDefinition4.statisticType = "sum";
							   statisticDefinition4.onStatisticField = "Shape_Length";
							   statisticDefinition4.outStatisticFieldName = "tleng";
							   query2.outStatistics = [statisticDefinition3,statisticDefinition4];
							   queryTask.execute(query2,function (result) {
									dojo.forEach(result.features, function(feature) {
										data.tarea =feature.attributes.tarea.toFixed(2);
										data.tleng =feature.attributes.tleng.toFixed(2);
									});
										 dataGrid.refresh();
								   });
							    datas.push(data);
							  
					});
		            var memStore = new Memory({
		                data: datas,
		                idProperty: "stree"
		              });
				      dataGrid.set("store", memStore);
				      floatingPane.startup();
				     
				});

		}
	
	// 自行车
	ssmap.regionalizationZXC= function () {
		var floatingPane =dijit.byId("floatingPane");
		if(floatingPane) {
			floatingPane.destroyRecursive();
		}
		  var searchurl = appConfig.gisPath+"/arcgis/rest/services/fsjt/bj/MapServer/5"; 
	      var columns = [{
	            label: "区",
	            className:"index",
	            field: "dist"
	        },{
	            label: "区域面积(平方米)",
	            field: "area"
	        },{
	            label: "自行车道面积(平方米)",
	            field: "tarea"
	        },{
	            label: "所占比率",
	            field: "",
			    get:function(item){
			         return ((item.tarea/item.area)*100).toFixed(2)+"%";
			    }
	        },{
	            label: "自行车道长度(米)",
	            field: "tleng"
	        }
	        ];
	  	var dataGrid = new (declare([Grid, Selection]))({
		    bufferRows: Infinity,
             firstLastArrows: false,
		    columns: columns,
		    selectionMode: "single",
		    "class": "listtj2Grid"
		});
		var node = document.createElement('div');
		dojo.body().appendChild(node);
		var dChart= new dijit.layout.ContentPane({
			content:"	<table class='chart-area' id='chart-area' style='width: 700px;'><tr><td style='width: 400px;'>" +
					"<div id='pie' class='chart'></div><div id='pie_legend'></div></td><td style='width: 400px;'>" +
					"<div id='cols' class='chart'></div><div id='cols_legend' ></div></td></tr></table>"
			
		});
	    var floatingPane = new dojox.layout.FloatingPane({
	    	draggable:true,
	    	closable :true,
	    	resizable:false,
	    	maxable:false,
	    	dockable:false,
	    	id:"floatingPane",
	    	refreshOnShow:true,
	    	style:"width:800px;  height:430px;padding:5px;z-index: 9999;top: 0px;left:285px;overflow: hidden; ",
		        title:"自行车道统计分析"
		      },node);
			    floatingPane.addChild(new dijit.form.Button({label :"导出excel",iconClass :"dijitIconTable",onClick:function(){
			    	exportExcelF(dataGrid,"自行车道统计分析");
			    }}));
		      floatingPane.addChild(dataGrid);
		      floatingPane.addChild(dChart);
		   var queryTask = new QueryTask(searchurl);
			  var query = new Query();
				query.returnGeometry = true;
				query.outFields = [ "*" ];
				query.where = "1 = 1"; 
				query.orderByFields =["DistId"]
				queryTask.execute(query,function (featureSet) {
					
					var results = featureSet.features;
					var datas =[];
					dojo.forEach(results, function(feature) {
						var  distId = feature.attributes["DistId"];
						 if(distId) {
							 distId = distId.substr(-1,2);
						 }
						 var tarea =0,tleng=0;
						  var queryTask = new QueryTask(appConfig.gisPath+"/arcgis/rest/services/fsjt/ss/MapServer/49");
							   var data= {
					                    // property names used here match those used when creating the dgrid
					                    "dist":feature.attributes["DistName"],
					                    "area":feature.attributes["SHAPE_Area"],
					                    "tarea": tarea,
					                    "tleng": tleng
					                  }
							   var query2 = new Query();
							   //query.returnGeometry = true;
								//query.geometry= map.extent;
							   query2.outFields = [ "*" ];
							   query2.where = " 编码 like '_____0"+distId+"____'"; 
							   //query.geometry = feature.geometry;
							   var statisticDefinition3 = new StatisticDefinition();
							   statisticDefinition3.statisticType = "sum";
							   statisticDefinition3.onStatisticField = "Shape_Area";
							   statisticDefinition3.outStatisticFieldName = "tarea";
							   var statisticDefinition4 = new StatisticDefinition();
							   statisticDefinition4.statisticType = "sum";
							   statisticDefinition4.onStatisticField = "Shape_Length";
							   statisticDefinition4.outStatisticFieldName = "tleng";
							   query2.outStatistics = [statisticDefinition3,statisticDefinition4];
							   queryTask.execute(query2,function (result) {
									dojo.forEach(result.features, function(feature) {
										data.tarea =feature.attributes.tarea.toFixed(2);
										data.tleng =feature.attributes.tleng.toFixed(2);
									});
										 dataGrid.refresh();
								   });
							    datas.push(data);
							    //dataGrid.refresh();
					});
		            var memStore = new Memory({
		                data: datas,
		                idProperty: "stree"
		              });
				      dataGrid.set("store", memStore);
				      floatingPane.startup();

				});

		}
	
	//路网密度
	ssmap.regionalizationCD= function () {
		var floatingPane =dijit.byId("floatingPane");
		if(floatingPane) {
			floatingPane.destroyRecursive();
		}
		  var searchurl = appConfig.gisPath+"/arcgis/rest/services/fsjt/bj/MapServer/5"; 
	      var columns = [{
	            label: "区",
	            className:"index",
	            field: "dist"
	        },{
	            label: "快速路(米)",
	            field: "ksl"
	        },{
	            label: "主干路(米)",
	            field: "zgl"
	        },{
	            label: "次干路(米)",
	            field: "cgl"
	        },{
	            label: "支路(米)",
	            field: "zl"
	        },{
	            label: "道路长度",
	            get:function (_item) {
	            	var tleng = new Number(0);
	            	_item.tleng =tleng.add(_item.cgl).add(_item.zl).add(_item.zgl).add(_item.ksl).toFixed(2);
	            	return _item.tleng;
	            }
	        }
	        ];
		  	var dataGrid = new (declare([Grid, Selection]))({
			    bufferRows: Infinity,
	             firstLastArrows: false,
			    columns: columns,
			    selectionMode: "single",
			    "class": "listtjGrid"
			});
			var node = document.createElement('div');
			dojo.body().appendChild(node);
			var dChart= new dijit.layout.ContentPane({
				content:"	<table class='chart-area' id='chart-area' style='width: 700px;'><tr><td style='width: 400px;'>" +
						"<div id='pie' class='chart'></div><div id='pie_legend'></div></td><td style='width: 400px;'>" +
						"<div id='cols' class='chart'></div><div id='cols_legend' ></div></td></tr></table>"
				
			});
		    var floatingPane = new dojox.layout.FloatingPane({
		    	draggable:true,
		    	id:"floatingPane",
		    	closable :true,
		    	resizable:false,
		    	maxable:false,
		    	dockable:false,
		    	refreshOnShow:true,
		    	style:"width:800px; height:500px;padding:5px;z-index: 9999;top: 0px;left:285px;overflow: hidden; ",
		        title:"城市道路网络总长度"
		      },node);
		    floatingPane.addChild(new dijit.form.Button({label :"导出excel",iconClass :"dijitIconTable",onClick:function(){
		    	exportExcelF(dataGrid,"城市道路网络总长度");
		    }}));
		      floatingPane.addChild(dataGrid);
		      floatingPane.addChild(dChart);
		   var queryTask = new QueryTask(searchurl);
			  var query = new Query();
				query.returnGeometry = true;
				query.outFields = [ "*" ];
				query.where = "1 = 1"; 
				query.orderByFields =["DistId"]
				queryTask.execute(query,function (featureSet) {
					var results = featureSet.features;
					var datas =[];
					dojo.forEach(results, function(feature) {
						var  distId = feature.attributes["DistId"];
						 if(distId) {
							 distId = distId.substr(-1,2);
						 }
						 var tarea =0,tleng=0,ksl=0,zgl=0,cgl=0,zl=0;
							   var data= {
					                    // property names used here match those used when creating the dgrid
					                    "dist":feature.attributes["DistName"],
					                    "area":feature.attributes["SHAPE_Area"],
					                    "ksl": ksl,
					                    "zgl": zgl,
					                    "cgl": cgl,
					                    "zl": zl,
					                    "tleng":tleng
					                  }
							   var query = new Query();
							   query.outFields = [ "*" ];
							   query.where = " 道路编号  like '_____0"+distId+"____'"; 
							   var statisticDefinition2 = new StatisticDefinition();
							   statisticDefinition2.statisticType = "sum";
							   statisticDefinition2.onStatisticField = "道路长度";
							   statisticDefinition2.outStatisticFieldName = "dlcd";
							   query.outStatistics = [ statisticDefinition2];
							  // query7.geometry = feature.geometry;
							   var queryTask = new QueryTask(appConfig.gisPath+"/arcgis/rest/services/fsjt/ss/MapServer/51");
							   queryTask.execute(query,function (result) {
								   var dlcd =0;
									dojo.forEach(result.features, function(feature) {
										dlcd =feature.attributes.dlcd;
									});
									data.zgl = dlcd.toFixed(2);
										 dataGrid.refresh();
								   });
							   var queryTask2 = new QueryTask(appConfig.gisPath+"/arcgis/rest/services/fsjt/ss/MapServer/52");
							   queryTask2.execute(query,function (result) {
								   var dlcd =0;
									dojo.forEach(result.features, function(feature) {
										dlcd =feature.attributes.dlcd;
									});
									data.cgl = dlcd.toFixed(2);
										 dataGrid.refresh();
								   });
							   var queryTask3 = new QueryTask(appConfig.gisPath+"/arcgis/rest/services/fsjt/ss/MapServer/53");
							   queryTask3.execute(query,function (result) {
								   var dlcd =0;
									dojo.forEach(result.features, function(feature) {
										dlcd =feature.attributes.dlcd;
									});
									data.zl = dlcd.toFixed(2);
										 dataGrid.refresh();
								   });
							    datas.push(data);
							    dataGrid.refresh();
					});
		            var memStore = new Memory({
		                data: datas,
		                idProperty: "index"
		              });
				      dataGrid.set("store", memStore);
				      floatingPane.startup();
				     
				});
				 var yarray =["主干路","次干路","支路及以下等级道路"];
					statstcolandpie("/fsjt/dl/roadbasic!statisticsM.action",yarray);
		}
	
	//路网密度
	ssmap.regionalizationQL= function () {
		var floatingPane =dijit.byId("floatingPane");
		if(floatingPane) {
			floatingPane.destroyRecursive();
		}
		  var searchurl = appConfig.gisPath+"/arcgis/rest/services/fsjt/bj/MapServer/5"; 
	      var columns = [{
	            label: "区",
	            className:"index",
	            field: "dist"
	        },{
	            label: "特大桥",
	            field: "ksl"
	        },{
	            label: "大桥",
	            field: "zgl"
	        },{
	            label: "中桥",
	            field: "cgl"
	        },{
	            label: "小桥",
	            field: "zl"
	        },{
	            label: "涵洞",
	            field: "hd"
	        },{
	            label: "总数",
	            get:function (_item) {
	            	var tleng = new Number(0);
	            	_item.tleng =tleng.add(_item.cgl).add(_item.zl).add(_item.zgl).add(_item.ksl).add(_item.hd).toFixed(0);
	            	return _item.tleng;
	            }
	        }
	        ];
		  	var dataGrid = new (declare([Grid, Selection]))({
			    bufferRows: Infinity,
	             firstLastArrows: false,
			    columns: columns,
			    selectionMode: "single",
			    "class": "listtj2Grid"
			});
			var node = document.createElement('div');
			dojo.body().appendChild(node);
			var dChart= new dijit.layout.ContentPane({
				content:"	<table class='chart-area' id='chart-area' style='width: 700px;'><tr><td style='width: 400px;'>" +
						"<div id='pie' class='chart'></div><div id='pie_legend'></div></td><td style='width: 400px;'>" +
						"<div id='cols' class='chart'></div><div id='cols_legend' ></div></td></tr></table>"
				
			});
		    var floatingPane = new dojox.layout.FloatingPane({
		    	draggable:true,
		    	closable :true,
		    	resizable:false,
		    	maxable:false,
		    	id:"floatingPane",
		    	dockable:false,
		    	refreshOnShow:true,
		    	style:"width:800px;  height:430px;padding:5px;z-index: 9999;top: 0px;left:285px;overflow: hidden; ",
		        title:"城市桥梁分布情况"
		      },node);
		    floatingPane.addChild(new dijit.form.Button({label :"导出excel",iconClass :"dijitIconTable",onClick:function(){
		    	exportExcelF(dataGrid,"城市桥梁分布情况");
		    }}));
		      floatingPane.addChild(dataGrid);
		      floatingPane.addChild(dChart);
		   var queryTask = new QueryTask(searchurl);
			  var query = new Query();
				query.returnGeometry = true;
				query.outFields = [ "*" ];
				query.where = "1 = 1"; 
				query.orderByFields =["DistId"]
				queryTask.execute(query,function (featureSet) {
					var results = featureSet.features;
					var datas =[];
					dojo.forEach(results, function(feature) {
						var  distId = feature.attributes["DistId"];
						 if(distId) {
							 distId = distId.substr(-1,2);
						 }
						 var tarea =0,tleng=0,ksl=0,zgl=0,cgl=0,zl=0,hd=0;
							   var data= {
					                    // property names used here match those used when creating the dgrid
					                    "dist":feature.attributes["DistName"],
					                    "area":feature.attributes["SHAPE_Area"],
					                    "ksl": ksl,
					                    "zgl": zgl,
					                    "cgl": cgl,
					                    "zl": zl,
					                    "hd":hd,
					                    "tleng":tleng
					                  }
							   var query = new Query();
							   query.outFields = [ "*" ];
							   query.where = " 桥梁编码  like '_____0"+distId+"____'"; 
							   query.groupByFieldsForStatistics=['规模 '];
							   var statisticDefinition2 = new StatisticDefinition();
							   statisticDefinition2.statisticType = "count";
							   statisticDefinition2.onStatisticField = "规模";
							   statisticDefinition2.outStatisticFieldName = "gs";
							   query.outStatistics = [ statisticDefinition2];
							  // query7.geometry = feature.geometry;
							   var queryTask = new QueryTask(appConfig.gisPath+"/arcgis/rest/services/fsjt/ss/MapServer/33");
							   queryTask.execute(query,function (result) {
									dojo.forEach(result.features, function(feature) {
										var type =feature.attributes['规模'];
										//console.log(type)
										if("特大" == type ) {
											data.ksl = feature.attributes.gs;
										}
										else if("大桥" == type ) {
											data.zgl = feature.attributes.gs;
										}else if("中桥" == type ) {
											data.cgl = feature.attributes.gs;
										}else if("小桥" == type ) {
											data.zl = feature.attributes.gs;
										}else if("涵洞" == type ) {
											data.hd = feature.attributes.gs;
										}
									});
									 dataGrid.refresh();
								   });
							    datas.push(data);
							    dataGrid.refresh();
					});
		            var memStore = new Memory({
		                data: datas,
		                idProperty: "index"
		              });
				      dataGrid.set("store", memStore);
				      floatingPane.startup();
				     
				});
//				 var yarray =["主干路","次干路","支路及以下等级道路"];
//					statstcolandpie("/fsjt/dl/roadbasic!statisticsM.action",yarray);
		}
	//路网密度
	ssmap.regionalizationLW= function () {
		var floatingPane =dijit.byId("floatingPane");
		if(floatingPane) {
			floatingPane.destroyRecursive();
		}
		  var searchurl = appConfig.gisPath+"/arcgis/rest/services/fsjt/bj/MapServer/5"; 
	      var columns = [{
	            label: "区",
	            className:"index",
	            field: "dist"
	        },{
	            label: "区面积(平方米)",
	            className:"index",
	            field: "area"
	        },{
	            label: "快速路(平方米)",
	            field: "ksl"
	        },{
	            label: "主干路(平方米)",
	            field: "zgl"
	        },{
	            label: "次干路(平方米)",
	            field: "cgl"
	        },{
	            label: "支路(平方米)",
	            field: "zl"
	        },{
	            label: "道路总面积(平方米)",
	            get:function (_item) {
	            	var tarea = new Number(0);
	            	_item.tarea =tarea.add(_item.cgl).add(_item.zl).add(_item.zgl).add(_item.ksl).toFixed(2);
	            	return _item.tarea;
	            }
	        },{
	            label: "所占比率",
	            field: "",
			    get:function(item){
			         return ((item.tarea/item.area)*100).toFixed(2)+"%";
			    }
	        }
	        ];
			var dataGrid = new (declare([Grid, Selection]))({
			    bufferRows: Infinity,
                 firstLastArrows: false,
			    columns: columns,
			    selectionMode: "single",
			    "class": "listtj2Grid"
			});
			var dChart= new dijit.layout.ContentPane({
				content:"	<table class='chart-area' id='chart-area' style='width: 700px;'><tr><td style='width: 400px;'>" +
						"<div id='pie' class='chart'></div><div id='pie_legend'></div></td><td style='width: 400px;'>" +
						"<div id='cols' class='chart'></div><div id='cols_legend' ></div></td></tr></table>"
				
			});
			var node = document.createElement('div');
			dojo.body().appendChild(node);
		    var floatingPane = new dojox.layout.FloatingPane({
		    	draggable:true,
		    	closable :true,
		    	resizable:false,
		    	id:"floatingPane",
		    	maxable:false,
		    	dockable:false,
		    	refreshOnShow:true,
		    	style:"width:800px;  height:430px;padding:5px;z-index: 9999;top: 0px;left:285px;overflow: hidden; ",
		        title:"城市道路网络密度情况"
		      },node);
		    floatingPane.addChild(new dijit.form.Button({label :"导出excel",iconClass :"dijitIconTable",onClick:function(){
		    	exportExcelF(dataGrid,"城市道路网络密度情况");
		    }}));
		      floatingPane.addChild(dataGrid);
		      floatingPane.addChild(dChart);
		      var queryTask = new QueryTask(searchurl);
			  var query = new Query();
				query.returnGeometry = true;
				query.outFields = [ "*" ];
				query.where = "1 = 1"; 
				query.orderByFields =["DistId"]
				queryTask.execute(query,function (featureSet) {
					var results = featureSet.features;
					var datas =[];
					dojo.forEach(results, function(feature) {
						var  distId = feature.attributes["DistId"];
						 if(distId) {
							 distId = distId.substr(-1,2);
						 }
						 var tarea =0,tleng=0,ksl=0,zgl=0,cgl=0,zl=0;
						  var queryTask = new QueryTask(appConfig.gisPath+"/arcgis/rest/services/fsjt/ss/MapServer/51");
							   var data= {
					                    // property names used here match those used when creating the dgrid
					                    "dist":feature.attributes["DistName"],
					                    "area":feature.attributes["SHAPE_Area"],
					                    "ksl": ksl,
					                    "zgl": zgl,
					                    "cgl": cgl,
					                    "zl": zl,
					                    "tarea":tarea
					                  }
							   var query = new Query();
							   query.outFields = [ "*" ];
							   query.where = " 道路编号  like '_____0"+distId+"____'"; 
							   var statisticDefinition2 = new StatisticDefinition();
							   statisticDefinition2.statisticType = "sum";
							   statisticDefinition2.onStatisticField = "道路总面积";
							   statisticDefinition2.outStatisticFieldName = "tarea";
							   query.outStatistics = [ statisticDefinition2 ];
							  // query7.geometry = feature.geometry;
							   queryTask.execute(query,function (result) {
								   var tarea =0;
									dojo.forEach(result.features, function(feature) {
										tarea =feature.attributes.tarea;
									});
									data.zgl = tarea.toFixed(2);
										 dataGrid.refresh();
								   });
							   var queryTask2 = new QueryTask(appConfig.gisPath+"/arcgis/rest/services/fsjt/ss/MapServer/52");
							   queryTask2.execute(query,function (result) {
								   var tarea =0;
									dojo.forEach(result.features, function(feature) {
										tarea =feature.attributes.tarea;
									});
									data.cgl = tarea.toFixed(2);
										 dataGrid.refresh();
								   });
							   var queryTask3 = new QueryTask(appConfig.gisPath+"/arcgis/rest/services/fsjt/ss/MapServer/53");
							   queryTask3.execute(query,function (result) {
								   var tarea =0;
									dojo.forEach(result.features, function(feature) {
										tarea =feature.attributes.tarea;
									});
									data.zl = tarea.toFixed(2);
										 dataGrid.refresh();
								   });
							    datas.push(data);
							    dataGrid.refresh();
					});
		            var memStore = new Memory({
		                data: datas,
		                idProperty: "index"
		              });
				      dataGrid.set("store", memStore);
				      floatingPane.startup();
				     // var yarray =["主干路","次干路","支路及以下等级道路"];
					//	statstcolandpie("/fsjt/dl/roadbasic!statisticsM.action",yarray);
				});

		}
	
	//人行天桥
	ssmap.regionalizationRXTQ= function () {
		var floatingPane =dijit.byId("floatingPane");
		if(floatingPane) {
			floatingPane.destroyRecursive();
		}
		  var searchurl = appConfig.gisPath+"/arcgis/rest/services/fsjt/bj/MapServer/5"; 
	      var columns = [{
	            label: "区",
	            className:"index",
	            field: "dist"
	        },{
	            label: "人行天桥数目",
	            field: "rxtqs"
	        },{
	            label: "其中有电梯的数目",
	            field: "hdts"
	        },{
	            label: "电梯的总数目",
	            field: "dts"
	        }
	        ];
			var dataGrid = new (declare([Grid, Selection]))({
			    bufferRows: Infinity,
                 firstLastArrows: false,
			    columns: columns,
			    selectionMode: "single",
			    "class": "listtj2Grid"
			});
			var dChart= new dijit.layout.ContentPane({
				content:"	<table class='chart-area' id='chart-area' style='width: 700px;'><tr><td style='width: 400px;'>" +
						"<div id='pie' class='chart'></div><div id='pie_legend'></div></td><td style='width: 400px;'>" +
						"<div id='cols' class='chart'></div><div id='cols_legend' ></div></td></tr></table>"
				
			});
			var node = document.createElement('div');
			dojo.body().appendChild(node);
		    var floatingPane = new dojox.layout.FloatingPane({
		    	draggable:true,
		    	closable :true,
		    	resizable:false,
		    	maxable:false,
		    	id:"floatingPane",
		    	dockable:false,
		    	refreshOnShow:true,
		    	style:"width:800px;  height:430px;padding:5px;z-index: 9999;top: 0px;left:285px;overflow: hidden; ",
		        title:"城市道路人行天桥情况"
		      },node);
		    floatingPane.addChild(new dijit.form.Button({label :"导出excel",iconClass :"dijitIconTable",onClick:function(){
		    	exportExcelF(dataGrid,"城市道路网络密度情况");
		    }}));
		      floatingPane.addChild(dataGrid);
		      floatingPane.addChild(dChart);
		      var queryTask = new QueryTask(searchurl);
			  var query = new Query();
				query.returnGeometry = true;
				query.outFields = [ "*" ];
				query.where = "1 = 1"; 
				query.orderByFields =["DistId"]
				queryTask.execute(query,function (featureSet) {
					var results = featureSet.features;
					var datas =[];
					dojo.forEach(results, function(feature) {
						var  distId = feature.attributes["DistId"];
						 if(distId) {
							 distId = distId.substr(-1,2);
						 }
						 
							   var data= {
					                    // property names used here match those used when creating the dgrid
					                    "dist":feature.attributes["DistName"],
					                    "area":feature.attributes["SHAPE_Area"],
					                    "rxtqs": 0,
					                    "hdts": 0,
					                    "dts": 0
					                  }
							   var query = new Query();
							   query.outFields = [ "*" ];
							   query.where = " 编码  like '_____0"+distId+"____'"; 
							   var queryTask = new QueryTask(appConfig.gisPath+"/arcgis/rest/services/fsjt/ss/MapServer/30");
							   queryTask.execute(query,function (result) {
								   var rxtqs = 0,hdts =0,dts=0;
									dojo.forEach(result.features, function(feature) {
										rxtqs = rxtqs +1;
										var d = feature.attributes["总电梯座数"];
										dts =accAdd(dts,d);
										if("0" != d ) {
											hdts  = hdts +1;
										}
									});
									data.rxtqs =rxtqs ;
									data.hdts =hdts ;
									data.dts = dts ;
									 dataGrid.refresh();
								   });
							    datas.push(data);
							    dataGrid.refresh();
					});
		            var memStore = new Memory({
		                data: datas,
		                idProperty: "index"
		              });
				      dataGrid.set("store", memStore);
				      floatingPane.startup();
				});

		}
	// 交通管理设施统计汇总的数据  准确性需要核对
	ssmap.regionalizationJTSX = function () {
		var floatingPane =dijit.byId("floatingPane");
		if(floatingPane) {
			floatingPane.destroyRecursive();
		}
		  var searchurl = appConfig.gisPath+"/arcgis/rest/services/fsjt/bj/MapServer/5"; 
	      var columns = [{
	            label: "区",
	            className:"index",
	            field: "dist"
	        },{
	            label: "区面积(平方米)",
	            field: "area"
	        },{
	            label: "交通标志（面）",
	            field: "jtbz"
	        },{
	            label: "交通标线（万平方米）",
	            field: "jtbx"
	        },{
	            label: "隔离护栏（米）",
	            field: "glhl"
	        },{
	            label: "交叉路口(共)",
	            field: "jclk"
	        },{
	            label: "信控路口(个)",
	            field: "xklk"
	        },{
	            label: "渠化路口(个)",
	            field: "chlk"
	        }
	        ];
			var dataGrid = new (declare([Grid, Selection]))({
			    bufferRows: Infinity,
                 firstLastArrows: false,
			    columns: columns,
			    selectionMode: "single",
			    style:'height:300px;',
			    "class": "listtj2Grid"
			});
			var dChart= new dijit.layout.ContentPane({
				content:"	<table class='chart-area' id='chart-area' style='width: 700px;'><tr><td style='width: 400px;'>" +
						"<div id='pie' class='chart'></div><div id='pie_legend'></div></td><td style='width: 400px;'>" +
						"<div id='cols' class='chart'></div><div id='cols_legend' ></div></td></tr></table>"
				
			});
			var node = document.createElement('div');
			dojo.body().appendChild(node);
		    var floatingPane = new dojox.layout.FloatingPane({
		    	draggable:true,
		    	closable :true,
		    	id:"floatingPane",
		    	resizable:false,
		    	maxable:false,
		    	dockable:false,
		    	refreshOnShow:true,
		    	style:"width:800px; height:430px;padding:5px;z-index: 9999;top: 0px;left:285px;overflow: hidden; ",
		        title:"城市交通管理设施情况统计表"
		      },node);
		      floatingPane.addChild(new dijit.form.Button({label :"导出excel",iconClass :"dijitIconTable",onClick:function(){
		    	  exportExcelF(dataGrid,"城市交通管理设施情况统计表");
		      }}));
		      floatingPane.addChild(dataGrid);
		   var queryTask = new QueryTask(searchurl);
			  var query = new Query();
				query.returnGeometry = true;
				query.outFields = [ "*" ];
				query.where = "1 = 1"; 
				query.orderByFields =["DistId"]
				queryTask.execute(query,function (featureSet) {
					var results = featureSet.features;
					var datas =[];
					dojo.forEach(results, function(feature) {
						var  distId = feature.attributes["DistId"];
						 if(distId) {
							 distId = distId.substr(-1,2);
						 }
						 var tarea =0,tleng=0,jtbx=0,jtbz=0,glhl=0,jclk=0,xklk=0,chlk=0;
						 var data= {
				                    // property names used here match those used when creating the dgrid
				                    "dist":feature.attributes["DistName"],
				                    "area":feature.attributes["SHAPE_Area"],
				                    "jtbz": jtbz,
				                    "jtbx": jtbx,
				                    "glhl": glhl,
				                    "jclk": jclk,
				                    "xklk": xklk,
				                    "chlk": chlk
				                  }
						  var queryTask1 = new QueryTask(appConfig.gisPath+"/arcgis/rest/services/fsjt/ss/MapServer/1");
						   var query1 = new Query();
							   query1.outFields = [ "*" ];
							   query1.where = "1 = 1"; 
							   query1.geometry = feature.geometry;
							  queryTask1.executeForCount(query1,function (count) {
									 data.jtbz = data.jtbz+count;
									 dataGrid.refresh();
							   });
							  // 统计交通标志
							var queryTask11= new QueryTask(appConfig.gisPath+"/arcgis/rest/services/fsjt/ss/MapServer/2");
							 queryTask11.executeForCount(query1,function (count) {
										 data.jtbz = data.jtbz+count;
										 dataGrid.refresh();
								   });
							var queryTask12 = new QueryTask(appConfig.gisPath+"/arcgis/rest/services/fsjt/ss/MapServer/3");
							 queryTask12.executeForCount(query1,function (count) {
										 data.jtbz = data.jtbz+count;
										 dataGrid.refresh();
								   });
							var queryTask13 = new QueryTask(appConfig.gisPath+"/arcgis/rest/services/fsjt/ss/MapServer/4");
							 queryTask13.executeForCount(query1,function (count) {
										 data.jtbz = data.jtbz+count;
										 dataGrid.refresh();
								   });
							var queryTask14 = new QueryTask(appConfig.gisPath+"/arcgis/rest/services/fsjt/ss/MapServer/5");
							 queryTask14.executeForCount(query1,function (count) {
										 data.jtbz = data.jtbz+count;
										 dataGrid.refresh();
								   });
							var queryTask16 = new QueryTask(appConfig.gisPath+"/arcgis/rest/services/fsjt/ss/MapServer/6");
								 queryTask16.executeForCount(query1,function (count) {
											 data.jtbz = data.jtbz+count;
											 dataGrid.refresh();
									   });
							// 统计交叉口
							var queryTask3 = new QueryTask(appConfig.gisPath+"/arcgis/rest/services/fsjt/ss/MapServer/16");
								var query3 = new Query();
								   query3.outFields = [ "*" ];
								   query3.where = "1 = 1"; 
								   query3.geometry = feature.geometry;
								queryTask3.executeForCount(query3,function (count) {
											 data.jclk = count;
											 dataGrid.refresh();
									   });
							var queryTask4 = new QueryTask(appConfig.gisPath+"/arcgis/rest/services/fsjt/ss/MapServer/16");
								var query4 = new Query();
								   query4.outFields = [ "*" ];
								   query4.where = " 红绿灯数量 <> '0' "; 
								   query4.geometry = feature.geometry;
								queryTask4.executeForCount(query4,function (count) {
											 data.xklk = count;
											 dataGrid.refresh();
									   });
								var queryTask5 = new QueryTask(appConfig.gisPath+"/arcgis/rest/services/fsjt/ss/MapServer/16");
								var query5 = new Query();
								   query5.outFields = [ "*" ];
								   query5.where = " 是否有安全 = '是' "; 
								   query5.geometry = feature.geometry;
								queryTask5.executeForCount(query5,function (count) {
											 data.chlk = count;
											 dataGrid.refresh();
									   });
								//隔离护栏
								//http://192.168.0.5:6080/arcgis/rest/services/fsjt/ss/MapServer/15
								var queryTask6 = new QueryTask(appConfig.gisPath+"/arcgis/rest/services/fsjt/ss/MapServer/14");
								var query6 = new Query();
								   query6.outFields = [ "SHAPE_Leng"];
								   query6.where = " 编码 like '_____0"+distId+"____'"; 
								   //query6.geometry = feature.geometry;
								   var statisticDefinition = new StatisticDefinition();
								   statisticDefinition.statisticType = "sum";
								   statisticDefinition.onStatisticField = "Shape_Length";
								   statisticDefinition.outStatisticFieldName = "glhl";
								   query6.outStatistics = [ statisticDefinition ];
								  queryTask6.execute(query6,function (results) {
//									  var results = featureSet.features;
//									  var l=0;
//										dojo.forEach(results, function(graphic) {
//											var leng = graphic.attributes["SHAPE_Leng"];
//											l = accAdd(l,leng);
//										});
									  		data.glhl =(results.features[0].attributes.glhl).toFixed(2);
											 dataGrid.refresh();
									   });
								// 标线
								console.log(distId);
								//http://192.168.0.5:6080/arcgis/rest/services/fsjt/ss/MapServer/15
								var queryTask7 = new QueryTask(appConfig.gisPath+"/arcgis/rest/services/fsjt/ss/MapServer/13");
								var query7 = new Query();
								   query7.outFields = [ "*" ];
								   query7.where = " 编码 like '_____0"+distId+"____'"; 
								   var statisticDefinition2 = new StatisticDefinition();
								   statisticDefinition2.statisticType = "sum";
								   statisticDefinition2.onStatisticField = "Shape_Length";
								   statisticDefinition2.outStatisticFieldName = "bxcd";
								   query7.outStatistics = [ statisticDefinition2 ];
								   query7.groupByFieldsForStatistics=["标线宽度（m_"],
								  // query7.geometry = feature.geometry;
								   queryTask7.execute(query7,function (result) {
									   var jtbx =0;
										dojo.forEach(result.features, function(feature) {
											var bxcd =feature.attributes.bxcd;
											var bxkd =feature.attributes['标线宽度（m_'];
											 var bxmj = bxcd*bxkd;
											 console.log(bxmj);
											 jtbx = accAdd(jtbx ,bxmj).toFixed(2);
										});
										data.jtbx = accDiv(jtbx,10000).toFixed(2);
											 dataGrid.refresh();
									   });
								 dataGrid.refresh();
							    datas.push(data);
							   
					});
		            var memStore = new Memory({
		                data: datas,
		                idProperty: "stree"
		              });
				      dataGrid.set("store", memStore);
				      floatingPane.startup();
				});

		}
	
	// 停车位  停车位数未完成 需要将 数量 及停车位数改成数字类型才能进行统计
	ssmap.regionalizationTCSS= function () {
		var floatingPane =dijit.byId("floatingPane");
		if(floatingPane) {
			floatingPane.destroyRecursive();
		}
		  var searchurl = appConfig.gisPath+"/arcgis/rest/services/fsjt/bj/MapServer/5"; 
	      var columns = [{
	            label: "区",
	            className:"index",
	            field: "dist"
	        },{
	            label: "区域面积(平方米)",
	            field: "area"
	        },{
	            label: "路内停车场数量",
	            field: "lntcg"
	        },{
	            label: "路内停车场泊位数量",
	            field: "lntcs"
	        },{
	            label: "路外停车场数量",
	            field: "lwtcg"
	        },{
	            label: "路外停车场泊位数量",
	            field: "lwtcs"
	        }
	        ];
	  	var dataGrid = new (declare([Grid, Selection]))({
		    bufferRows: Infinity,
             firstLastArrows: false,
		    columns: columns,
		    selectionMode: "single",
		    "class": "listtj2Grid"
		});
		var node = document.createElement('div');
		dojo.body().appendChild(node);
		var dChart= new dijit.layout.ContentPane({
			content:"	<table class='chart-area' id='chart-area' style='width: 700px;'><tr><td style='width: 400px;'>" +
					"<div id='pie' class='chart'></div><div id='pie_legend'></div></td><td style='width: 400px;'>" +
					"<div id='cols' class='chart'></div><div id='cols_legend' ></div></td></tr></table>"
			
		});
	    var floatingPane = new dojox.layout.FloatingPane({
	    	draggable:true,
	    	closable :true,
	    	resizable:false,
	    	maxable:false,
	    	id:"floatingPane",
	    	dockable:false,
	    	refreshOnShow:true,
	    	style:"width:800px;  height:430px;padding:5px;z-index: 9999;top: 0px;left:285px;overflow: hidden; ",
		        title:"公共与配建停车设施总量情况统计表"
		      },node);
			    floatingPane.addChild(new dijit.form.Button({label :"导出excel",iconClass :"dijitIconTable",onClick:function(){
			    	exportExcelF(dataGrid,"公共与配建停车设施总量情况统计表");
			    }}));
		      floatingPane.addChild(dataGrid);
		      floatingPane.addChild(dChart);
		   var queryTask = new QueryTask(searchurl);
			  var query = new Query();
				query.returnGeometry = true;
				query.outFields = [ "*" ];
				query.where = "1 = 1"; 
				query.orderByFields =["DistId"]
				queryTask.execute(query,function (featureSet) {
					var results = featureSet.features;
					var datas =[];
					dojo.forEach(results, function(feature) {
						var  distId = feature.attributes["DistId"];
						 if(distId) {
							 distId = distId.substr(-1,2);
						 }
						 var tarea =0,tleng=0,lntcg=0,lntcs=0,lwtcg=0,lwtcs=0;
						 var data= {
								 // property names used here match those used when creating the dgrid
								 "dist":feature.attributes["DistName"],
								 "area":feature.attributes["SHAPE_Area"],
								 "lntcg": lntcg,
								 "lntcs": lntcs,
								 "lwtcg": lwtcg,
								 "lwtcs": lwtcs,
						 }
						  var queryTask = new QueryTask(appConfig.gisPath+"/arcgis/rest/services/fsjt/ss/MapServer/24");
						  var query = new Query();
							   //query.returnGeometry = true;
								//query.geometry= map.extent;
							   query.outFields = [ "*" ];
							   query.where = " 编码 like '_____0"+distId+"____'"; 
							   //query.geometry = feature.geometry;
							   var statisticDefinition = new StatisticDefinition();
							   statisticDefinition.statisticType = "count";
							   statisticDefinition.onStatisticField = "OBJECTID";
							   statisticDefinition.outStatisticFieldName = "lntcg";
							   var statisticDefinition2 = new StatisticDefinition();
							   statisticDefinition2.statisticType = "sum";
							   statisticDefinition2.onStatisticField = "数量";
							   statisticDefinition2.outStatisticFieldName = "lntcs";
							   query.outStatistics = [ statisticDefinition,statisticDefinition2];
							   queryTask.execute(query,function (result) {
									dojo.forEach(result.features, function(feature) {
										console.debug("ee",feature);
										data.lntcg =feature.attributes.lntcg;
										data.lntcs =feature.attributes['lntcs'];
									});
										 dataGrid.refresh();
								   });
							  var queryTask2 = new QueryTask(appConfig.gisPath+"/arcgis/rest/services/fsjt/ss/MapServer/23");
							  
							  var query2 = new Query();
							   //query.returnGeometry = true;
								//query.geometry= map.extent;
							   query2.outFields = [ "*" ];
							   query2.where = " 编码 like '_____0"+distId+"____'"; 
							   //query.geometry = feature.geometry;
							   var statisticDefinition3 = new StatisticDefinition();
							   statisticDefinition3.statisticType = "count";
							   statisticDefinition3.onStatisticField = "OBJECTID";
							   statisticDefinition3.outStatisticFieldName = "lwtcg";
							   var statisticDefinition4 = new StatisticDefinition();
							   statisticDefinition4.statisticType = "sum";
							   statisticDefinition4.onStatisticField = "停车位数";
							   statisticDefinition4.outStatisticFieldName = "lwtcs";
							   query2.outStatistics = [ statisticDefinition3,statisticDefinition4];
							   queryTask2.execute(query2,function (result) {
									dojo.forEach(result.features, function(feature) {
										data.lwtcg =feature.attributes.lwtcg;
										data.lwtcs =feature.attributes['lwtcs'];
									});
										 dataGrid.refresh();
								   });
							    datas.push(data);
							    //dataGrid.refresh();
					});
		            var memStore = new Memory({
		                data: datas,
		                idProperty: "stree"
		              });
				      dataGrid.set("store", memStore);
				      floatingPane.startup();
//				      var yarray =["城市快速路","主干路","次干路","支路及以下等级道路"];
//						statstcolandpie("/fsjt/dl/roadbasic!statisticsM.action",yarray);
				});

			}

		});